#!/bin/bash 
set -e

TMP=${TMP:-/tmp/work}
LOG=${LOG:-$HOME/logs/stage3}
SRC=${SRC:-/sources}

name=util-linux
version=2.36.2

rm -rf $TMP
mkdir -p $TMP $LOG

tar xf $SRC/$name-$version.tar.xz -C $TMP

{ time \
   {

    cd $TMP/$name-$version
    
	./configure ADJTIME_PATH=/var/lib/hwclock/adjtime   \
				--docdir=/usr/share/doc/$name-$version  \
				--disable-chfn-chsh  \
				--disable-login      \
				--disable-nologin    \
				--disable-su         \
				--disable-setpriv    \
				--disable-runuser    \
				--disable-pylibmount \
				--disable-static     \
				--without-python     \
				runstatedir=/run
    
    make
    
    make install

    }
} 2>&1 | tee $name.log
    
[ $PIPESTATUS = 0 ] && mv $name.log $LOG || exit $PIPESTATUS

rm -fr $TMP
